#include <iostream>
#include <algorithm>
using namespace std;
typedef long long LL;
#define endl '\n'
const int N = 5e5 + 10;
LL a[N];
LL gcd(LL a, LL b)
{
    return b == 0 ? a : gcd(b, a % b);
}
void solve() 
{
    int n; cin >> n;
    for(int i = 1; i <= n; i++) cin >> a[i];
    LL ans = 0;
    for(int i = 1; i <= n; i++)
    {
        ans = gcd(ans, abs(a[i] - i));
    }
    int ret = 0;
    for(int i = 1; i <= ans; i++)
    {
        if(ans % i == 0) ret++;
    }
    if(ret == 0) ret = n;
    cout << ret << endl;
}

int main()
{
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int T = 1;
	while(T--)
	{
        solve();
	}
	return 0;
}